package com.zfei.gfb.bean;

public class CommonConst {

    public static final String appId = "wx0f7cdbdfe42c9acf";
    public static final String appSecret = "1392f4468f0d41ad0037c79c9b3d04de";

    /**
     * 微信开放平台二维码连接
     */
    public final static String OPEN_QRCODE_URL= "https://open.weixin.qq.com/connect/qrconnect?appid=%s&redirect_uri=%s&response_type=code&scope=snsapi_login&state=%s#wechat_redirect";

    /**
     * 开放平台回调url
     * 注意：test16web.tunnel.qydev.com 域名地址要和在微信端 回调域名配置 地址一直，否则会报回调地址参数错误
     */
    public final static String OPEN_REDIRECT_URL= "http://newsweb.cnepaper.net/web/user/wxback";


    public static final int STATUS_OFF = 0;
    public static final int STATUS_ON = 1;
    public static final int STATUS_REFUSE = 2;

    public static final int USER_TYPE_PLATFORM = 1;
    public static final int USER_TYPE_MER = 2;

    public static final int SYS_TYPE_PAPER_TYPE = 1;  //报纸类别
    public static final int SYS_TYPE_PAPER_NATURE = 2;  //报纸属性
    public static final int SYS_TYPE_PAGE_NATURE = 3;  //版面属性
    public static final int SYS_TYPE_PAPER_EXPIRE = 4;  //报纸过期
    public static final int SYS_TYPE_SENSE_WORD = 5;  //敏感词

    public static final int PAPER_TYPE_PAPER = 1;
    public static final int PAPER_TYPE_MAGAZINE = 2;


    public static final int VOICE_MAN_01 = 1;
    public static final int VOICE_MAN_02 = 2;
    public static final int VOICE_WOMAN_01 = 3;

    public static boolean legalStatus(Integer status) {
        if (status == null) {
            return true;
        }
        return status == STATUS_ON || status == STATUS_OFF;
    }

    public static boolean legalPrivStatus(Integer status) {
        if (status == null) {
            return true;
        }
        return status == STATUS_ON || status == STATUS_REFUSE;
    }

    public static boolean legalVoiceStatus(Integer status) {
        if (status == null) {
            return true;
        }
        return status == VOICE_MAN_01 || status == VOICE_MAN_02 || status == VOICE_WOMAN_01;
    }


    public enum Sys {
        paperType(SYS_TYPE_PAPER_TYPE, "报纸分类"),
        paperNature(SYS_TYPE_PAPER_NATURE, "报纸属性"),
        pageNature(SYS_TYPE_PAGE_NATURE, "版面属性"),
        paperExpire(SYS_TYPE_PAPER_EXPIRE, "报纸期限"),
        senseWord(SYS_TYPE_SENSE_WORD, "敏感词");
        private int type;
        private String name;

        Sys(int type, String name) {
            this.type = type;
            this.name = name;
        }

        public static String toString(Integer type) {
            Sys[] values = Sys.values();
            for (Sys sys : values) {
                if (sys.type == type) {
                    return sys.name;
                }
            }
            return null;
        }
    }
}
